/**
 * 
 */
$(document).ready(function() {	
	var validator = $('#urlforce').validate({
		rules: {				
			textform: {
				required: {
					depends:function(){
						$('#textform').val($('#textform').val().replace(' ',''));
			            return true;
			        }
				},
				url: true
			}
		},
		messages: {				
			textform: {
				required: 'This field is required',
				url: 'Please, enter a valid URL'	
			}				
		},
		success: function(label) {							
		},		
		submitHandler: function( form ){ 
			$('.img').attr('src', 'images/tank2.gif');
            $.get("workinghard.php?url="+$('#textform').val(),function(data) {
            	$('.img').attr('src', 'images/tank.gif');
				$('.error').html(data);
			});
            return false;  
        },
        errorElement: 'span',
        onkeyup: false
	});
		
	$('#loadUrl').click(function() {		
		$('.error').html('');
		$('#urlforce').submit();		
	});	
	
});